<!DOCTYPE html>
<html>
<head>
    <title>网站制作</title>
</head>
<body>
  <div>数据库：<input type="text" id="database"></div>
  <div><input type="button" id="ok" value="确定"></div>
</body>
<script type="text/javascript" src="{:config('JS_PATH')}jquery.min.js"></script>
<script type="text/javascript">
    $('#ok').click(function(){
        let $database = $('#database')
        if ($database.val() === '') {
            alert('请输入数据库名')
            return false
        }
        $.ajax({
            type: 'post', dataType: 'json', cache: false,
            url: '{:url("index")}',
            data: {'database': $database.val()},
            success: function($data){
                if ($data.status === 200) {
                    alert('创建成功')
                } else {
                    alert('创建失败')
                }
            }
        })
    })
</script>
</html>